package com.ldz.redis.model;

import java.io.Serializable;
import java.util.UUID;

public abstract class TaskBase implements Serializable,Comparable<TaskBase> {
    //优先级 越大越优先
    private int priority = 5;
    String taskId = UUID.randomUUID().toString();

    //此任务需要执行的语句
    public abstract void taskExc();

    //比较优先级
    @Override
    public int compareTo(TaskBase t) {
        if(t.priority > this.priority){
            return -1;
        } else {
            return 0;
        }
    }

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
}
